package cn.k7g.codeflow.utils;

import jakarta.el.MethodNotFoundException;

import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.stream.Collectors;

public class Util {
    public static String getMethodId(Method method) {
        String clsName = method.getDeclaringClass().getName();
        String mName = method.getName();
        String collect = Arrays.stream(method.getParameters()).map(o -> o.getType().getName()).collect(Collectors.joining(","));
        return clsName + "#" + mName + "@" + collect;
    }

    /**
     * 根据 methodId 解析出 method
     * @param methodId 函数ID
     * @return Method 函数类型
     * @throws MethodNotFoundException 找不到函数，可能存在的情况是变化了
     */
    public static Method parseMethod(String methodId) throws MethodNotFoundException {

        return null ;
    }
}
